package com.sanbi.shield.server.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Knife4j配置
 *
 * @author XiaoQingqing
 * @since 2024/06/17
 */
@EnableWebMvc
@Configuration
@EnableSwagger2
public class Knife4jConfiguration {

    @Bean
    public Docket restApiDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("uno-user API文档")
                        .description("Knife4j API文档")
                        .version("1.0.0")
                        .build())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.sanbi.shield.server.controller"))
                .paths(PathSelectors.any())
                .build();
    }
}

